package com.ojoin.trade.supplyloan_core.web.service.catchdata;

import java.io.IOException;
import java.util.Map;

import com.ojoin.trade.common.exception.BusinessException;
import com.ojoin.trade.supplyloan_core.web.domain.TbSlPlatformUser;

/**
 * 供应链贷 数据抓取基类 服务接口
 * 
 * @author guoting
 * 
 */
public interface ISLDataCatchBaseService {

	/**
	 * 共用参数缓存
	 * 
	 * @return
	 */

	public Map<String, Object> getContext();
   
	boolean init(); 
	/**
	 * 获取下载目录路径
	 * 
	 * @return
	 */
	public String getDownloadDir() throws IOException;

	/**
	 * 抓取数据预处理（配置数据抓取器）
	 * 
	 * @throws BusinessException
	 * @throws Exception 
	 */
	public boolean prepareCatchData() throws BusinessException, Exception;

	/**
	 * 是否登录成功
	 * 
	 * @return
	 * @throws BusinessException
	 */

	public boolean isLoginSuccess() throws Exception;

	/**
	 * 是否缓存session在线
	 * 
	 * @return
	 * @throws BusinessException
	 */
	public boolean isCacheLogin() throws BusinessException;

	void saveCookies()  throws IOException;
	/**
	 * 登陆
	 * 
	 * @param baseUrl
	 * @param username
	 * @param password
	 * @return
	 * @throws BusinessException
	 */
	public boolean LoginByUserInfo(String baseUrl, String username,
			String password) throws Exception;

	/**
	 * 抓取供应商名称
	 * 
	 * @return
	 */
	public String catchSupplierName() throws BusinessException;

	public boolean isSupplyAccountCorrect() throws BusinessException;

	/**
	 * 抓取供应商结算账号
	 * 
	 * @return
	 */
	public String catchSupplierAccount() throws BusinessException;

	public boolean isSupplyInfoCorrect() throws BusinessException;

	public boolean isTaskRunSuccess() throws BusinessException, Exception;

	/**
	 * 抓取数据
	 * 
	 * @param user
	 * @param defaultLoginUrl
	 * @throws BusinessException
	 * @throws Exception 
	 */
	public void catchData(TbSlPlatformUser user) throws BusinessException, Exception;

	/**
	 * 关闭抓取数据
	 * 
	 * @return
	 * @throws BusinessException
	 */
	public void closeCatchData(boolean isuser) throws BusinessException;

	/**
	 * 关闭抓取数据
	 * 
	 * @return
	 * @throws BusinessException
	 */
	public void closeCatchData(boolean islogin, boolean isuser)
			throws BusinessException;

	/**
	 * 获取电商业务单据数据
	 * 
	 * @return
	 * @throws BusinessException
	 * @throws Exception 
	 */
	public void getBusinessData() throws BusinessException, Exception;

	/**
	 * 获取未付款结算单数据
	 * 
	 * @return
	 * @throws BusinessException
	 */
	public boolean getUnpayAccountData()
			throws  BusinessException, IOException;

	/**
	 * 获取已付款结算单数据
	 * 
	 * @return
	 * @throws BusinessException
	 * @throws Exception 
	 */
	public boolean getPayAccountData() throws BusinessException, Exception;

	/**
	 * 获取出库单数据
	 * 
	 * @return
	 * @throws BusinessException
	 */
	public boolean getOutstoreOrderData()
			throws BusinessException;

	/**
	 * 获取出库单数据
	 * 
	 * @return
	 * @throws BusinessException
	 */
	public boolean getInstoreOrderData()
			throws IOException;

	/**
	 * 验证码处理
	 * 
	 * @return
	 * @throws BusinessException
	 */

	public void verifycode() throws Exception;

}
